<?php if (!defined('BASEPATH'))exit('No direct script access allowed');

class Login extends CI_Controller
{
    public function index()
    {
        if($this->session->userdata('logged_in_user') == true)
        {
            $this->template->home('home/v_profil', null, 'Login');
        }
        else
        {
            $data = "";
            $this->template->home('home/v_login', $data, 'Login');  
        }
    }
    
    public function proses()
    {
        $username = $this->input->post('nama_user');
        $password = $this->input->post('password');
        if($username != "" && $password != "")
        {
            if($this->authlogin->login_user($username, $password, false, 'logged_in_user') == true)
            {
                redirect();
            }
            else
            {
                $this->index();
            }
        }
        else
        {
            $this->index();
        }
    }
    
    public function logout()
    {
        $this->authlogin->logout('logged_in_user');
        redirect('login');
    }
}

/* End of file login.php */
/* Location: ./application/controllers/login.php */